package me.sdevil507.org.mapper;

import me.sdevil507.org.dto.OrgInviteParamsDto;
import me.sdevil507.org.dto.OrgInviteResultDto;
import me.sdevil507.org.po.OrgInvitePo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 邀请记录表[OrgInviteMapper]
 *
 * @author sdevil507
 * created on 2020-08-13 13:34:40
 */
@Component
@Mapper(componentModel = "spring", nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface OrgInviteMapper {

    /**
     * po => dto
     *
     * @param po 实体类
     * @return dto传输类
     */
    OrgInviteResultDto po2dto(OrgInvitePo po);

    /**
     * pos => dtos
     *
     * @param pos 实体类集合
     * @return dtos传输类集合
     */
    List<OrgInviteResultDto> pos2dtos(List<OrgInvitePo> pos);

    /**
     * dto => po
     *
     * @param dto 传输类
     * @return po实体类
     */
    OrgInvitePo dto2po(OrgInviteParamsDto dto);

    /**
     * dtos => pos
     *
     * @param dtos 传输类集合
     * @return pos实体类集合
     */
    List<OrgInvitePo> dtos2pos(List<OrgInviteParamsDto> dtos);

    /**
     * 使用dto更新po
     *
     * @param dto 传输类
     * @param po  实体类
     */
    void updatePoFromDto(OrgInviteParamsDto dto, @MappingTarget OrgInvitePo po);
}